﻿using ConstructorAsyncWebApi.Services;
using IoTCenter.Utilities.Extensions;

namespace ConstructorAsyncWebApi.ServicesImpl
{
    public class DataSegmentationService : IDataSegmentationService
    {
        private readonly IDataGenerationService _dataGenerationService;

        public DataSegmentationService(IDataGenerationService dataGenerationService)
        {
            _dataGenerationService = dataGenerationService;
        }

        public async Task<IList<string>> SegmentationSummarys()
        {
            var datas = await _dataGenerationService.Generate();
            if (datas.IsEmpty())
            {
                return null;
            }

            return datas.Select(x => $"{x.Id}_{x.Summary}").ToList();
        }

        public async Task<IList<string>> SegmentationIds()
        {
            var datas = await _dataGenerationService.Generate();
            if (datas.IsEmpty())
            {
                return null;
            }

            return datas.Select(x => $"{x.Id}_{x.Summary}").ToList();
        }


    }
}
